/*
 * Copyright (C) 2025 Thomas Akehurst
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.github.tomakehurst.wiremock.db.service;

import com.github.tomakehurst.wiremock.db.entity.MultiMappingEntity;
import com.github.tomakehurst.wiremock.stubbing.StubMapping;
import com.github.tomakehurst.wiremock.stubbing.StubMappingCollection;

import java.util.List;

/**
 * 多存根业务接口
 * 定义多存根文件的查询、删除等核心能力，与单存根业务解耦
 */
public interface MultiMappingService {

  /**
   * 查询所有多存根文件中的存根（扁平化处理，仅返回Stub列表）
   * @return 所有多存根文件中的Stub集合
   */
  List<StubMapping> findAllAsStubMappings();

  /**
   * 根据多存根文件ID删除多存根记录
   * @param id 多存根文件ID（contentId）
   */
  void deleteById(String id);

  /**
   * 根据多存根文件ID查询完整集合（保留集合结构，不扁平化）
   * @param id 多存根文件ID（contentId）
   * @return 完整的多存根集合（含集合元信息）
   */
  StubMappingCollection findCollectionById(String id);

  /**
   * 根据单StubID查询关联的多存根实体（用于判断单Stub是否属于多存根文件）
   * @param stubId 单Stub的ID
   * @return 关联的多存根实体（若不存在则抛异常）
   */
  MultiMappingEntity findByStubId(String stubId);
}
